package com.hrm.model.daoimple;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.hrm.model.dao.MilitaryDAO;
import com.hrm.model.dto.insa.MilitaryDTO;

public class MilitaryDAOImple extends SqlMapClientDaoSupport implements MilitaryDAO {

	@Override
	public List<MilitaryDTO> getAllMilitary(MilitaryDTO dto) {
		return (List<MilitaryDTO>) this.getSqlMapClientTemplate().queryForList("MilitaryMap.getAllMilitary", dto);
	}

	@Override
	public boolean deleteMilitary(MilitaryDTO dto) {
		try{
			this.getSqlMapClientTemplate().delete("MilitaryMap.deleteMilitary", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}

	@Override
	public boolean insertMilitary(MilitaryDTO dto) {
		try{
			this.getSqlMapClientTemplate().insert("MilitaryMap.insertMilitary", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}

	@Override
	public boolean updateMilitary(MilitaryDTO dto) {
		try{
			this.getSqlMapClientTemplate().update("MilitaryMap.updateMilitary", dto);
		}catch (Exception e) {
			System.out.println(e.getMessage());
			return false;
		}
		return true;
	}
}
